tags 446160 + patch
thanks
The attached patch adds support for directly invoking an MDA. It adds
a new configuration option "MDA" to config.py, which defaults to None.
If set to a list of strings, rss2email will invoke that program with
arguments as a mail delivery agent, and feed it the email. For
instance, I use:
MDA = ["/usr/lib/dovecot/deliver", "-e"]
Note that I renamed the global function list() to list_feeds(), to
avoid conflicting with the Python builtin list() constructor.
- Josh Triplett
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.22-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages rss2email depends on:
ii python 2.4.4-6 An interactive high-level object-o
ii python-feedparser 4.1-9 Universal Feed Parser for Python
ii python-support 0.7.5 automated rebuilding support for p
rss2email recommends no packages.
-- no debconf information
diff -Naur rss2email-2.60.orig/config.py rss2email-2.60/config.py
--- rss2email-2.60.orig/config.py 2007-11-11 22:18:35.000000000 -0800
+++ rss2email-2.60/config.py 2007-11-11 22:33:51.000000000 -0800
@@ -47,6 +47,10 @@
SMTP_USER = ' username' # for SMTP AUTH, set SMTP username here
SMTP_PASS = 'password' # for SMTP AUTH, set SMTP password here
+# Set this to a list of strings to deliver mail with the specified MDA
+# (with arguments).
+MDA = None
+
# Set this to add a bonus header to all emails (start with '\n').
BONUS_HEADER = ''
# Example: BONUS_HEADER = '\nApproved: [EMAIL PROTECTED]'
diff -Naur rss2email-2.60.orig/rss2email.py rss2email-2.60/rss2email.py
--- rss2email-2.60.orig/rss2email.py 2007-11-11 22:18:35.000000000 -0800
+++ rss2email-2.60/rss2email.py 2007-11-11 23:39:56.000000000 -0800
@@ -16,7 +16,8 @@
___contributors__ = ["Dean Jackson", "Brian Lalor", "Joey Hess",
"Matej Cepl", "Martin 'Joey' Schulze",
"Marcel Ackermann (http://www.DreamFlasher.de)",
- "Lindsey Smith ([EMAIL PROTECTED])" ]
+ "Lindsey Smith ([EMAIL PROTECTED])",
+ "Josh Triplett ([EMAIL PROTECTED])"]
### Vaguely Customizable Options ###
@@ -67,6 +68,10 @@
SMTP_USER = 'username' # for SMTP AUTH, set SMTP username here
SMTP_PASS = 'password' # for SMTP AUTH, set SMTP password here
+# Set this to a list of strings to deliver mail with the specified MDA
+# (with arguments).
+MDA = None
+
# Set this to add a bonus header to all emails (start with '\n').
BONUS_HEADER = ''
# Example: BONUS_HEADER = '\nApproved: [EMAIL PROTECTED]'
@@ -147,6 +152,10 @@
mimify.mimify(ins, outs)
msg_as_string = outs.getvalue()
+ if SMTP_SEND and MDA is not None:
+ print >>warn, ""
+ print >>warn, ('Fatal error: configuration specifies both
SMTP_SERVER and MDA.')
+
if SMTP_SEND:
if not smtpserver:
import smtplib
@@ -179,13 +188,17 @@
return smtpserver
else:
- i, o = os.popen2(["/usr/sbin/sendmail", recipient])
+ if MDA is not None:
+ mail_process = list(MDA)
+ else:
+ mail_process = ["/usr/sbin/sendmail", recipient]
+ i, o = os.popen2(mail_process)
i.write(msg_as_string)
i.close(); o.close()
pid, status = os.wait()
if status != 0:
print >>warn, ""
- print >>warn, ('Fatal error: sendmail exited with code
%s' % status)
+ print >>warn, ('Fatal error: mail process (%s) exited
with code %s' % (str(mail_process), status))
sys.exit(1)
del i, o
return None
@@ -663,7 +676,7 @@
if smtpserver:
smtpserver.quit()
-def list():
+def list_feeds():
feeds, feedfileObject = load(lock=0)
default_to = ""
@@ -723,7 +736,7 @@
else: d = []
pickle.dump(d, open(feedfile, 'w'))
- elif action == "list": list()
+ elif action == "list": list_feeds()
elif action in ("help", "--help", "-h"): print __doc__